<!--添加餐柜-->
<template>
    <div>
        <!--1-->
        <el-row class="nav_a_top">
            <el-col :span="12"><div @click="fanhui" class="grid-content bg-purple-light"><div class="el-icon-back fs20"></div></div></el-col>
            <el-col :span="12"><div class="grid-content bg-purple-light floatright"><div>添加厨房</div></div></el-col>
        </el-row>
        <!--3-->
         <form class="dingdan_form">
            <div class="mattop"><span>公司名称：</span><input type="text"  v-model="companyname"></div>
            <div class="mattop"><span>详细地址：</span><input type="text" v-model="adress"></div>
            <div class="mattop"><span>联系人：</span><input type="text" v-model="linkman"></div>
            <div class="mattop"><span>手机号：</span><input type="phone" v-model="phone"></div>
            <div class="mattop">
                <span>管理人员：</span>
                <select v-for="item of staff"  v-model="selected_one">
                    <option>{{item}}</option>
                </select>
            </div>
            <div class="mattop1" ><span>备注：</span><input type="text" v-model='beizhu'></div>
            <div class="mattop">
                <span>所在地区：</span>
                <select v-model="selected_two">
                    <option v-for="item of citydata">{{item}}</option>
                </select>
            </div>
            <button @click="save">保存</button>
        </form>
    </div>
</template> 
<script>
    import axios from 'axios'
    export default{
        name:'addchufang',
         data () {
            return {
                    citydata:null,
                    staff:null,
                    companyname:'美的餐厅', 
                    adress: '商鼎路榆林北路',
                    linkman: '李红旗',
                    phone: '13838169642',
                    beizhu:'',
                    selected_one:'',
                    selected_two:'',
            }
        },
        methods:{
            fanhui:function(){
                this.$store.state.chumanage=true;
                this.$store.state.chuadd=false;
            },
            save:function(){
                  axios({
                    url:this.$store.state.base +this.$store.state.posturl.url1,
                    method:'post',
                    data:{
                                name:this.companyname,
                                mobile:this.phone,
                                contact:this.linkman,
                                business_admin_id:'1',
                                service_city:'1',
                                address:this.adress,
                                status:'1',
                                note:this.beizhu,
                    },
                    })
                    .then((res)=>{
                        console.log(res.data);
                    })
                console.log(this.companyname);
                console.log(this.adress);
                console.log(this.linkman);
                console.log(this.phone);
                console.log(this.beizhu);
            }
        },
        mounted:function(){
        },
        created:function(){
                // 获取业务城市
                axios.get(this.$store.state.base + this.$store.state.geturl.url2).then((res)=>{this.citydata = res.data.data;console.log(this.citydata);})
                // 获取厨房业务人员
                axios.get(this.$store.state.base + this.$store.state.geturl.url3).then((res)=>{this.staff=res.data.data;console.log(this.staff)})
        }
    }
</script>
<style scoped>  
/*1*/     
.floatright{float: right;margin-right: 30px;}
.fromtop{margin-top: 30px;}
/*3*/
.dingdan_form{margin-top: 15px;}
/*.dingdan_form>div{margin-top: 30px;}*/
.mattop{margin-top: 30px; }
.mattop1{margin-top:50px; }
.dingdan_form span{width: 75px;text-align: right;display: inline-block}
.dingdan_form input{padding: 4px 0px 4px 7px;}
.dingdan_form select{width: 180px;height: 30px;}
.dingdan_form_shaixuan{background-color: white;border: 1px solid #bbb;width: 80px;height: 30px;display: inline-block;border-radius: 7px;margin-left: 10px;background-color: #bbb;}
</style>